<?php
/**
*	刷新
*/
class wordClassModel extends Model
{
	public function reloadworc()
	{
		$dbs  = m('worc');
		$rows = $dbs->getall('1=1');
		foreach($rows as $k=>$rs){
			$onrs = $this->getone('fqid='.$rs['id'].' and `type`=0','sum(filesize) as sizeu, count(1) as fileshu');
			$sizeu = '0';
			$fileshu = '0';
			if($onrs){
				$sizeu 	= $onrs['sizeu'];
				$fileshu= $onrs['fileshu'];
				if(!$sizeu)$sizeu = 0;
				if(!$fileshu)$fileshu = 0;
			}
			$dbs->update('`sizeu`='.$sizeu.',`fileshu`='.$fileshu.'', $rs['id']);
		}
	}
	
	//获取我的分区
	public function getworc($ars)
	{
		$wher1 = m('dept')->replacewhere($ars,'{receid}');
		$crows = m('worc')->getall('`status`=1 and '.$wher1.'','id,name,fileshu,size,sizeu','sort asc');
		return $crows;
	}
}